package dao;

import utils.DBHelper;

import java.util.List;
import java.util.Map;

public class QueryUserdao {

    //个人主页查询
    public Map<String ,Object > queryuser(String username){
        String sql="select username,telphone,email,password,pic from users where username = ?";
        return  DBHelper.selectOneMap(sql,username);
    }

    //个人主页中保存信息
    public void save(String username,String tel,String email,String user){
        String sql="update users set  username=? , telphone=? , email=? where username = ? ";
        DBHelper.update(sql,username,tel,email,user);
    }
    //重置密码
    public void update_pwd(Integer uid, String pwd){
        String sql =" update users set password = ? where id = ?";
        DBHelper.update(sql,pwd,uid);
    }

    //销户
    public void deluser(Integer uid){
        String sql=" delete  from users where id = ?";
        DBHelper.update(sql,uid);
    }

    //查收货地址
    public List<Map<String,Object>> queryadd(Integer uid){
        String sql="select name,telphone,site from address where uid=?";
        return DBHelper.selectListMap(sql,uid);
    }
    public Map<String, Object> queryid(String username){
        String sql="select id from users where username = ?";
        return  DBHelper.selectOneMap(sql,username);
    }


}
